# !/bin/bash

/usr/bin/expect <<EOF
set time 5

spawn sudo mkfs -t ext4 /dev/nvme0n1
expect {
	"Proceed*" { send "y\r"; }
}



spawn sudo fdisk /dev/nvme0n1
expect {
	"Command" { send "n\r"; exp_continue }
	"*default p*" { send "p\r"; exp_continue }
	"Partition*" { send "1\r"; exp_continue }
	"First*" { send "\r"; exp_continue }
	"Last*" { send "251658240\r"; }
}
expect "Command" { send "w\r" }
expect eof
EOF

sudo mkfs -t ext4 -c /dev/nvme0n1p1

sudo /home/cz/rootOnNVMe/copy-rootfs-ssd.sh
sudo /home/cz/rootOnNVMe/setup-service.sh

